﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Common;
namespace Ym.print
{
    public partial class Base : PrintPageBase
    {
        private PBLL.PMenu bllMenu = new PBLL.PMenu();
        public string id = "1";
        public bool eShow = false;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    id = Request.QueryString["id"].ToString();
                }
                MenuRpt.DataSource = bllMenu.GetList("MCn<>''");
                PModel.PMenu model = bllMenu.GetModel(id);
                if (model != null)
                {
                    Text1.Value = model.MCn;
                    Text2.Value = model.MEn;
                    elm1.Value = model.MInfo;
                    eShow = model.EShow;
                    Hidden1.Value = model.Id.ToString();
                }
            }
            Page.DataBind();
        }

        protected void save_Click(object sender, EventArgs e)
        {
            PModel.PMenu model = new PModel.PMenu();
            model.MCn = Text1.Value;
            model.MEn = Text2.Value;
            model.MInfo = elm1.Value;
            model.Id = int.Parse(Hidden1.Value);
            bllMenu.Update(model);
            JscriptPrint("修改成功！", "Base.aspx?id=" + Hidden1.Value, "Success");
        }
    }
}